1. Field of the Invention
The invention relates in general to a Gamma correction method, and more particularly to a method for constructing a Gamma table to perform Gamma correction according to the Gamma table.
2. Description of the Related Art
The growth experienced in the computer industry brings along prosperity and development to its peripheral industries. The scanner, which helps the user to scan and store documents or images in the format of electronic files bringing great convenience to the user.
Please refer to FIG. 1, a schematic diagram of a Gamma curve illustrating the relationship between pixel data as shown in X-axis and pixel intensity as shown in Y-axis. An acquired picture obtained by scanning a picture is composed of a plurality of binary pixel data, which represent the intensity level for every corresponding dot of the picture. The relationship between pixel data and pixel intensity is illustrated in a Gamma curve as shown in FIG. 1. In the course of scanning, the scanner needs to execute pixel data conversion. After the pixel data conversion, a linear relationship should be obtained between the intensity level of every dot of the scanned picture and the acquired pixel data via scanning according to the Gamma curve. The above-mentioned conversion is called the “Gamma correction”. In this text, the relationship between actual pixel data and the pixel intensity obtained after the execution of Gamma correction is called the “Gamma relationship of pixel data”. Gamma correction is used to improve the display quality of the picture output of a scanner.
Suppose the pixel data produced by a color scanner are binary data of 16 bits. In order to store the corresponding Gamma relationship of pixel data, the scanner needs to have a memory capacity of at least 216×3 bytes (about 384 KB) for three primary colors namely the red, blue and green. The corresponding Gamma relationships of pixel data are referred to as a Gamma table. Because a large amount of memory capacity is required, the Gamma table is normally stored in an external memory device, such as a dynamic random access memory (DRAM) or a synchronous DRAM (SDRAM), outside the control IC of the scanner. When Gamma correction is performed, the execution speed is subject to the data access speed of the SDRAM or the DRAM as well as the capacity of the memory. In addition, the higher the memory capacity, the higher the price.
In order to speed up Gamma correction, a conventional approach is to reduce the size of Gamma table by storing the Gamma relationships of a part of pixel data only, leaving the Gamma relationships of the rest to be obtained via interpolation according to the Gamma relationships of the stored pixel data which are adjacent to the pixel data whose Gamma relationship are to be obtained. The selected and stored pixel data are called the “sampling pixel data”. One of the conventional sampling methods for sampling pixel data is to sample pixel data at a fixed interval. That is to say, the difference between every sampling pixel datum and its adjacent sampling pixel datum is a fixed value. When ranked in order, the pixel data will show an arithmetical series.
Please refer to FIG. 2, a schematic diagram illustrating a conventional Gamma correction method. For example, when Gamma correction is performed on pixel datum P3, the corresponding Gamma relationship of two sampling pixel data P1 and P2, which are close to P3, have already been stored in the Gamma table. According to the Gamma curve, sampling pixel data P1 and P2 correspond to pixel intensities L1 and L2 respectively. By means of interpolation, pixel intensity L3 corresponding to pixel datum P3 can be obtained accordingly. Therefore, the memory required to store the Gamma table can be further reduced. Moreover, the speed for executing Gamma correction can be further improved if the synchronous random access memory (SRAM) inside the control IC of the scanner is used to store the Gamma table.
The disadvantage for the above-mentioned conventional method lies in performing interpolation on pixel data that correspond to a portion of the Gamma curve whose slope changes widely. In this case, the discrepancy between the actual and the calculated Gamma relationships could be relatively large. Referring to FIG. 2, all of the three pixel data, P1, P2 and P3, lie on a segment of Gamma curve indicated by a dashed rectangular shown in FIG. 1. As can be examined from FIG. 2, with respect to pixel datum P3, a great discrepancy exists between the actual intensity, L3′, obtained from the Gamma curve and the calculated one, L3, obtained via interpolation. Such a great discrepancy will degrade the performance of Gamma correction and the display quality of scanned pictures.
In a Gamma curve of 2.2, for example, the actual curve ranges from (X, Y)=(0, 0) to (X, Y)=(256, 5260). Given X=61, the Y-value obtained via interpolation is 1,235 when the actual Y-value is 2,725. The resulting error is 1,490 or about 5.8 times 28. Such a great discrepancy is indeed too large to be accepted.